package com.itheima.filter;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * @Description Filter2
 * @Author junjie Wu 吴俊杰
 * @Date 2024-03-06
 */
@WebFilter(urlPatterns = "/*") //拦截所有的请求
@Slf4j
public class AFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        log.info("Filter2放行前执行的逻辑");
        chain.doFilter(request,response);
        log.info("Filter2放行后执行的逻辑");
    }


    @Override
    public void destroy() {
        Filter.super.destroy();
    }
}